<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
   
    <ui:composition template="/views/_template.xhtml">
        <ui:define name="corpo">
            <h:form> 
                <h:messages style="color: red"/>
                <p:outputLabel style="text-align: right; margin-left: 765px; color: #99a699;" value="Total de registros: #{contaBean.contas.size()}" />
                <p:outputLabel value="Contas" style="border-bottom: 3px solid #C22; text-align: left; font-size: 24px; width: 900px;" />
                <p:dataTable styleClass="dados" value="#{contaBean.contas}" var="conta" emptyMessage="Nenhum registro encontrado!">
                   <p:column style="text-align: left;" headerText="Banco" >
                        <h:outputText value="#{conta.banco.nomeBanco}"/>
                   </p:column>
                   <p:column style="text-align: left;" headerText="Conta" >
                        <h:outputText value="#{conta.nome}"/>
                   </p:column>
                   <p:column style="text-align: left;" headerText="Situação" >
                        <h:outputText value="#{conta.situacao}"/>
                   </p:column>
                   <p:column style="text-align: left;" headerText="Saldo" >
                        <h:outputText value="#{conta.saldo}">
                            <f:convertNumber type="currency" locale="pt_br" />
                        </h:outputText>
                   </p:column>
                   <p:column style="width: 10px;" headerText="Alterar"  >
                      <h:commandLink action="#{contaBean.alterar(conta)}">
                          <h:graphicImage library="imagens" name="edit-icon.gif" style="width: 30px; height: 20px;" />
                      </h:commandLink>
                   </p:column>
                   <p:column style="width: 10px;" headerText="Excluir">
                      <center>
                          <h:commandLink action="#{contaBean.remover(conta)}">
                              <h:graphicImage library="imagens" name="icon_delete.gif" style="width: 30px; height: 20px;" />
                          </h:commandLink>
                      </center>
                   </p:column>
                 </p:dataTable>
                 <br />
                 <p:commandButton value="Novo" action="/administrador/incluirConta"  ajax="false"/>
                 <p:commandButton value="Voltar" action="/index" immediate="true" ajax="false"/>   
            </h:form>
        </ui:define>
    </ui:composition>
</html>

